#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 1;
int f[MAXN][3] = {0};
int a[MAXN][3] = {0};
#define SWIM 1
#define WORM 2
#define HMWK 3
inline int max3(int x, int y, int z) {
    return max(max(x, y), z);
}
int main(void) {
    freopen("summer.in", "r", stdin);
    freopen("summer.out", "w", stdout);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i][SWIM] >> a[i][WORM] >> a[i][HMWK];
        f[i][SWIM] = max(f[i - 1][WORM], f[i - 1][HMWK]) + a[i][SWIM];
        f[i][WORM] = max(f[i - 1][SWIM], f[i - 1][HMWK]) + a[i][WORM];
        f[i][HMWK] = max(f[i - 1][SWIM], f[i - 1][WORM]) + a[i][HMWK];
    }
    cout << max3(f[n][SWIM], f[n][WORM], f[n][HMWK]);
    return 0;
}
